home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / BCEXAMS.PAK / MAKEFILE.GEN < prev    next >
Text File  |  1997-05-06  |  35KB  |  1,276 lines

  1. #-----------------------------------------------------------------------------
  2. # Copyright (c) 1993, 1995 by Borland International
  3. #
  4. # $Revision:   10.30  $
  5. #
  6. #  Common makefile generator for example makefiles
  7. #
  8. #  Usage for each makefile using this include, specify system and model:
  9. #    SYSTEM=WIN16 is implied unless MODEL=f, in which case WIN32 is implied
  10. #    MODEL=d (DLL) is implied unless SYSTEM=WIN32, in which case MODEL=f
  11. #
  12. #    make SYSTEM=WIN16 MODEL=s  builds 16bit Windows small model static
  13. #    make SYSTEM=WIN16 MODEL=m  builds 16bit Windows medium model static
  14. #    make SYSTEM=WIN16 MODEL=c  builds 16bit Windows compact model static
  15. #    make SYSTEM=WIN16 MODEL=l  builds 16bit Windows large model static
  16. #    make SYSTEM=WIN16 MODEL=d  builds 16bit Windows large model DLL
  17. #    make SYSTEM=WIN32 MODEL=f  builds 32bit Windows static version
  18. #    make SYSTEM=WIN32 MODEL=d  builds 32bit Windows DLL version
  19. #    make SYSTEM=WIN32 MODEL=t  builds 32bit app with cw32mt, bidst, etc.
  20. #    make SYSTEM=WIN32 MODEL=t USEDLL=1   links to cw32mti, bidsti, etc.
  21. #    make SYSTEM=DOS16 MODEL=s  builds 16bit DOS small model static
  22. #    make SYSTEM=DOS16 MODEL=m  builds 16bit DOS medium model static
  23. #    make SYSTEM=DOS16 MODEL=c  builds 16bit DOS compact model static
  24. #    make SYSTEM=DOS16 MODEL=l  builds 16bit DOS large model static
  25. #    make SYSTEM=CON32 MODEL=f  builds 32bit static console app
  26. #    make SYSTEM=CON32 MODEL=d  builds 32bit DLL console app
  27. #         -DDEBUG <or> DEBUG=1    add to enable debug info for TDW & TD32
  28. #         -DDIAGS <or> DIAGS=1    add to enable runtime diagnostics
  29. #         MAKEARGS=           make command args used to run generated makefile
  30. #         TARGET=  name.extension of a single target to make (rather than all)
  31. #
  32. #   For backward compatibility, SYSTEM may also be specied by -D, e.g. -DWIN32
  33. #
  34. # A specific makefile for the requested model will be generated as required.
  35. # The generated makefile will then be run to produce the target executables.
  36. # This generated makefile will be named {model}.MAK, where {model} is the
  37. # concatenation of the SYSTEM, MODEL, DIAGS, and DEBUG values. A zero-length
  38. # sentry file named {model}.MOD is produced to identify the built components.
  39. # Changing the model, system, diag, or debug values forces a complete rebuild.
  40. #
  41. # BCEXAMPLEDIR must be defined as the directory of this file and other *.gen
  42. # BCEXAMPLEDIR is defined by default to $(MAKEDIR)\..\EXAMPLES in BUILTINS.MAK
  43. # This may be redefined as an environment variable or on the MAKE command line
  44. #
  45. # The specification makefile in the project directory consists of a series of
  46. # definitions described below, followed by an include of this file or another
  47. # gen file which wrappers this file, i.e. !include $(BCEXAMPLEDIR)\owlmake.gen
  48. # Editing the specification makefile forces regeneration of target makefiles.
  49. #
  50. # Defines to specify *.EXE targets, generation of $(EXERULE):
  51. #   EXE=     Base name of .exe for app with no .rc file
  52. #   EXERES=  Base name of .exe for app with .rc -> .res file of same name
  53. #   RESEXE=  .res file(s) for EXE (define RESEXE_ also if more dependencies)
  54. #   RESEXE_= Dependent files for $(RESEXE), other than the corresponding .RC
  55. #   DEFEXE=  .def file for EXE, otherwise temp one will be generated
  56. #   OBJEXE=  Object file names, needed only if other than $(EXE).obj
  57. #   LIBEXE=  Library file names for extra libs if needed
  58. #   MAPEXE(=)Name for map file, else none will be generated
  59. #   CCFEXE=  Additional compiler flags for EXE, added after standard options
  60. #   EXEBIN=  Name with extension of executable if different from $(EXE).exe
  61. #   EXE_=    Additional dependencies for EXE, other than RESEXE and OBJEXE
  62. #   DOSSTUB= Specific stub to bind when running a Windows app under DOS
  63. #
  64. # Defines to specify *.DLL targets, generation of $(DLLRULE):
  65. #   DLL=     Base name of .dll for dynamic library with no .rc file
  66. #   DLLRES=  Base name of .dll for with .rc file with same base name
  67. #   OBJDLL=  Explicit list of .obj files for DLL, if other than $(DLL).obj
  68. #   LIBDLL=  Library file names for extra libs if needed for DLL
  69. #   RESDLL=  .res file(s) for DLL (use dependency line if >1 RC file)
  70. #   RESDLL_= Dependent files for $(RESDLL), other than the corresponding .RC
  71. #   DEFDLL=  .def file for DLL, otherwise generates one based on DLL
  72. #   MAPDLL(=)Name for map file, else none will be generated
  73. #   CCFDLL=  Additional compiler flags for EXE, added after standard options
  74. #   DLLBIN=  Name with extension of dynamic library if not $(DLL).dll
  75. #
  76. # Defines to specify *.HLP targets:
  77. #   HLP=     Helpfile base name, assumes .hlp made from .hpj
  78. #   HLP_=    Optional dependency files for helpfile, if more than $(HLP).hpj
  79. #
  80. # Defines to specify *.LIB targets:
  81. #   LIBBIN=  Static library to build (with extension), requires OBJLIB=
  82. #   OBJLIB=  Required list of object files for building static library LIBBIN
  83. #
  84. # Defines to specify additional targets to be included in generated makefile:
  85. #   TARGETS= Additional targets to build, rules must be defined in RULES
  86. #   RULES=   Additional rules and dependencies to be appended to the makefile
  87. #            Lines before the final line must be terminated with a caret (^)
  88. #
  89. # Defines to restrict the models or operating environments for the makefile:
  90. #   MODELS=  Optional list of supported models, else all valid models allowed
  91. #   SYSTEMS= Optional list of supported systems, else all platforms supported
  92. #   MODEL=   Forces a particular model, regardless of command line argument
  93. #   SYSTEM=  Forces a particular system, regardless of command line argument
  94. #
  95. # Defines to specify additional user include paths and libraries:
  96. #   USERINCPATH= Search path for include files, put before other include paths
  97. #   USERLIBPATH= Search path for user libraries specified without directories
  98. #   USERLIBS  = User libraries for EXEs and DLLs, won't be put as dependents
  99. #
  100. # Other defines:
  101. #   ALIGN=<1|2|4|8>   Specifies the alignment
  102. #   RTLFIRST=1        Force the RTL library before all other libraries
  103. #   CODEGUARD=<1|2>   Build with CodeGuard:  1=basic data, 2=full checking
  104. #   CPUOPT=<2|3|4|5>  Optimize for specific CPU
  105. #   MATHOPT=<0|1|2>   0=no math libs, 1=emulation, 2=coprocessor
  106. #   BCC32I            Use BCC32I.EXE instead of BCC32.EXE [32-bit only]
  107. #   ILINK          Uses ILINK32 instead of TLINK32 to link
  108. #   REDEFINE_BOOL     Enable mapping of 'BOOL' to 'bool'
  109. #   NAMESPACE         Assumes  ClassLib, OCF, and OWL are using namespaces
  110. #   VCL               Use namespaces, VCL-compatible options, and CP32MT(i)
  111. #   USEDLL            Use DLL versions of standard libs (rtl, bids...)
  112. #
  113. # These are available when building non DOS targets:
  114. #   OSMAJOR           Operating system major version number
  115. #   OSMINOR           Operating system minor version number
  116. #
  117. # For generating makefiles with multiple similar .exe targets:
  118. #   Generate a template EXE target rule using the EXE options for a sample EXE
  119. #   Then define rules for each EXE by substituting text within a previous rule
  120. #   $(EXERULE) is the automatically generated rule for the sample EXE target
  121. #   The following macros must be defined to override automatic EXE targeting
  122. #     EXEALL=  The list of all .exe targets, including extensions
  123. #     EXEMAKE= The list of all rules for the targets in EXEALL (may be macros)
  124. #
  125. # Similarly, for generating makefiles with multiple similar .dll targets:
  126. #   Substitute text in $(DLLRULE), $(DLLRULE:old=new), and define the following
  127. #     DLLALL=  The list of all .exe targets, including extensions
  128. #     DLLMAKE= The list of all rules for the targets in DLLALL (may be macros)
  129. #
  130. # When building VCL-compatible programs, both BCROOT and BCBROOT need
  131. # to be defined.  If BC5\BIN is on your path first, then BCROOT is
  132. # defined by default.  If C++Builder is on your path first, BCBROOT
  133. # is defined by default.  You must define the other one (or both)
  134. # explicitly as an environment variable in order for the makefile to
  135. # locate the OWL source in the BC5 tree and the VCL libraries in the
  136. # BCB tree.
  137. #
  138. #   BCROOT        defaults to: $(BCBROOT)  ; one of these is always
  139. #   BCBROOT       defaults to: $(BCROOT)   ; defined by default
  140. #
  141. #   VCLINCDIR     defaults to: $(BCBROOT)\include;($BCBROOT)\include\vcl
  142. #   VCLOBJDIR     defaults to: $(BCBROOT)\lib\obj
  143. #   VCLLIBDIR     defaults to: $(BCBROOT)\lib
  144. #-----------------------------------------------------------------------------
  145.  
  146. #-----------------------------------------------------------------------------
  147. # The following defaults set compiler and link options for machine targeting
  148. # They may be modified below or overridden by environment or command line
  149. #-----------------------------------------------------------------------------
  150.  
  151. !ifndef CPUOPT
  152. CPUOPT = 3   # =2 for 286, =3 for 386, =4 for 486, =5 for pentium
  153. !endif
  154.  
  155. !ifndef MATHOPT
  156. MATHOPT = 1  # =0 for no math libs, =1 for emulation, =2 for math coprocessor
  157. !endif
  158.  
  159.  
  160. #-----------------------------------------------------------------------------
  161.  
  162. .swap
  163.  
  164. #
  165. # Macros enclosed with underbars are for internal use only, i.e. _MODEL_
  166. # Other macros defined outside this file will not be altered unless incorrect
  167. #
  168.  
  169. #-----------------------------------------------------------------------------
  170. # Define macros for inserting spaces $(sp) and newlines $(nl)
  171. #-----------------------------------------------------------------------------
  172.  
  173. _sp_ = | |
  174. sp = $(_sp_:|=)
  175.  
  176. _nl_ = |^
  177. |
  178. nl = $(_nl_:|=)
  179.  
  180. #----------------------------------------------------------------------------
  181. # Validate or select target operating system
  182. #----------------------------------------------------------------------------
  183.  
  184. !ifndef SYSTEMS
  185. SYSTEMS = WIN16 DOS16 WIN32 CON32
  186. !endif
  187.  
  188. !ifndef SYSTEM
  189. ! if $d(WIN32) || "$(MODEL)"=="f" || "$(MODEL)" == "t" || $d(MT) || $d(VCL)
  190.   SYSTEM  = WIN32
  191. ! elif $d(CON32)
  192.   SYSTEM  = CON32
  193. ! elif $d(WIN16)
  194.   SYSTEM  = WIN16
  195. ! elif $d(DOS16)
  196.   SYSTEM  = DOS16
  197. ! else                              #default
  198. !   if !$d(MODEL)
  199.     SYSTEM  = WIN32
  200.     MODEL   = d
  201. !   else
  202.     SYSTEM  = WIN16
  203. !   endif
  204. ! endif
  205. !endif
  206.  
  207. _SYSTEMS_ = " $(SYSTEMS) "
  208. _SYSTEMX_ = |$(SYSTEM)|
  209. _SYSTEM_  = $(_SYSTEMX_:|= )
  210. !if $(_SYSTEMS_:$(_SYSTEM_)=)==$(_SYSTEMS_)
  211. ! error $(SYSTEM) system not supported
  212. !endif
  213.  
  214. #
  215. # Check for errors
  216. #
  217. !if $d(ILINK) && $d(WIN16)
  218. ! error Cannot build 16-bit targets with ILINK.
  219. !endif
  220. !if $d(VCL) && $(SYSTEM) == WIN16
  221. ! error VCL compatibility requires SYSTEM=WIN32
  222. !endif
  223. !if $d(VCL) && $(ALIGN) == 4
  224. ! error VCL compatibility requires ALIGN=4
  225. !endif
  226.  
  227. #
  228. # Generate boolean flags for use in platform testing
  229. #
  230. !if $(SYSTEM:32=)!=$(SYSTEM)
  231. _32BIT_=1
  232. !else
  233. _32BIT_=0
  234. !endif
  235. !if $(SYSTEM:WIN=)!=$(SYSTEM)
  236. _GUI_=1
  237. !else
  238. _GUI_=0
  239. !endif
  240.  
  241. #-----------------------------------------------------------------------------
  242. # The following defaults set the linker OS version
  243. # They may be modified below or overridden by environment or command line
  244. #-----------------------------------------------------------------------------
  245. !if ($d(OSMAJOR) && !$d(OSMINOR)) || (!$d(OSMAJOR) && $d(OSMINOR))
  246. ! error Both OSMAJOR and OSMINOR must be passed, not just one.
  247. !endif
  248.  
  249. !if $d(OSMAJOR) && SYSTEM == DOS16
  250. ! error OSMAJOR cannot be set for DOS targets.
  251. !endif
  252.  
  253. !if $d(OSMINOR) && SYSTEM == DOS16
  254. ! error OSMINOR cannot be set for DOS targets.
  255. !endif
  256.  
  257. #
  258. # default to 3.10  - NOTE: must be explicit about .10!
  259. #
  260. !if !$d(OSMAJOR) && !$d(OSMINOR)
  261. OSMAJOR = 3
  262. OSMINOR = 10
  263. !endif
  264.  
  265. #
  266. # Default alignment
  267. #
  268. !ifndef ALIGN
  269. ! if $d(VCL)
  270.     ALIGN=4
  271. ! elif $(_32BIT_)
  272.     ALIGN=1
  273. ! else
  274.     ALIGN=1
  275. ! endif
  276. !endif
  277.  
  278. #-----------------------------------------------------------------------------
  279. # Directory & search paths
  280. #-----------------------------------------------------------------------------
  281.  
  282. #
  283. # If neither or only one of the two root variables is defined,
  284. # read the file bcroot.inc and let it define whatever it wants to.
  285. #
  286. !if !$d(BCROOT) || !$d(BCBROOT)
  287. ! include $(MAKEDIR)\bcroot.inc
  288. ! if !$d(BCROOT) && !$d(BCBROOT)
  289.     BCROOT = $(MAKEDIR)\..
  290. ! endif
  291. !endif
  292.  
  293. #
  294. # At least one of the roots is certainly defined now.
  295. # If only one is defined, make them both the same.
  296. #
  297. !if !$d(BCROOT)
  298. BCROOT = $(BCBROOT)
  299. !elif !$d(BCBROOT)
  300. BCBROOT = $(BCROOT)
  301. !endif
  302.  
  303. # Where to find command-line tools, headers, and libraries
  304. !ifndef BCBINDIR
  305. BCBINDIR      = $(BCROOT)\bin
  306. !endif
  307. !ifndef BCINCDIR
  308. BCINCDIR      = $(BCROOT)\include
  309. !endif
  310. !ifndef BCLIBDIR
  311. BCLIBDIR      = $(BCROOT)\lib
  312. !endif
  313.  
  314. #
  315. # Where to find VCL libraries, objs, and headers
  316. #
  317. !if $d(VCL)
  318. ! if !$d(VCLLIBDIR)
  319.     VCLLIBDIR = $(BCBROOT)\lib
  320. ! endif
  321. ! if !$d(VCLOBJDIR)
  322.     VCLOBJDIR = $(VCLLIBDIR)\obj
  323. ! endif
  324. ! if !$d(VCLINCDIR)
  325. !   if "$(BCBROOT)" != "$(BCROOT)"
  326.       VCLINCDIR = $(BCBROOT)\include;$(BCBROOT)\include\vcl
  327. !   else
  328.       VCLINCDIR = $(BCBROOT)\include\vcl
  329. !   endif
  330. ! endif
  331. INCLUDE = $(INCLUDE);$(VCLINCDIR)
  332. !endif
  333.  
  334. !ifdef USERLIBPATH
  335. LIBRARYPATH = $(USERLIBPATH)$(sp)
  336. !endif
  337. #!ifdef VCL
  338. #LIBRARYPATH = $(VCLLIBDIR);$(LIBRARYPATH)
  339. #!endif
  340.  
  341. !ifdef SYSINCPATH
  342. _SYSINCPATH_ = $(SYSINCPATH)
  343. !endif
  344. !ifdef USERINCPATH
  345. INCLUDEPATH   = $(USERINCPATH);$(_SYSINCPATH_)
  346. !else
  347. INCLUDEPATH   = $(_SYSINCPATH_)
  348. !endif
  349. !ifdef VCL
  350. INCLUDEPATH = $(INCLUDEPATH);$(VCLINCDIR)
  351. !endif
  352. INCLUDEPATH = $(INCLUDEPATH);$(BCINCDIR)
  353.  
  354. #----------------------------------------------------------------------------
  355. # Validate or select compiler/library model
  356. #----------------------------------------------------------------------------
  357.  
  358. #
  359. # Set allowable models for each platform
  360. #
  361. !if   $(_32BIT_)
  362. ! if $d(VCL)
  363.     _MODELS_ = dt
  364. ! else
  365.     _MODELS_ = dfxt
  366. ! endif
  367. !elif $(_GUI_)
  368.   _MODELS_ = smcldx
  369. !else #DOS16
  370.   _MODELS_ = smclh
  371. !endif
  372.  
  373. !ifndef MODELS
  374. MODELS = $(_MODELS_:x=)
  375. !endif
  376.  
  377. #
  378. # Validate model if defined, else get default model
  379. #
  380. !ifndef MODEL
  381. ! if $(_32BIT_)
  382. !  if $d(VCL)
  383.    MODEL = t  #WIN32 threaded
  384. !  elif $(_GUI_)
  385.    MODEL = f  #WIN32
  386. !  else
  387.    MODEL = f  #CON32
  388. !  endif
  389. ! elif $(_GUI_)
  390.   MODEL = d  #WIN16
  391. ! else
  392.   MODEL = s  #DOS16
  393. ! endif
  394. !endif
  395.  
  396. #
  397. # Set MT for multithreading
  398. #
  399. !if "$(MODEL)"=="t"
  400.  MT = 1
  401. !endif
  402. !if $d(VCL)
  403.  MT = 1
  404. !endif
  405.  
  406. #
  407. # If model is not valid for this example, display error message and exit
  408. #
  409. !if ("$(MODELS:$(MODEL)=)"=="$(MODELS)")||("$(_MODELS_:$(MODEL)=)"=="$(_MODELS_)")
  410.  
  411. #
  412. # Convert MODEL to English
  413. #
  414. ! if $(MODEL)==s
  415. ERRSTR=Small model
  416. ! elif $(MODEL)==m
  417. ERRSTR=Medium model
  418. ! elif $(MODEL)==c
  419. ERRSTR=Compact model
  420. ! elif $(MODEL)==l
  421. ERRSTR=Large model
  422. ! elif $(MODEL)==h
  423. ERRSTR=Huge model
  424. ! elif $(MODEL)==d
  425. ERRSTR=DLL target
  426. ! elif $(MODEL)==f
  427. ERRSTR=Static target
  428. ! elif $(MODEL)==x
  429. ERRSTR=External DLL
  430. ! elif $(MODEL)==t
  431. ERRSTR=Multithread target
  432. ! else 
  433. ERRSTR=$(MODEL) model
  434. !endif
  435.  
  436. #
  437. # Use message to get everything on one line without path interfering
  438. #
  439. ! message Error $(ERRSTR), $(SYSTEM) is not supported for this program
  440. ! message Error Use MODEL=?, where ? is a supported model ($(MODELS))
  441. ! error Usage Error
  442. !endif
  443.  
  444. #
  445. # Set internal model for compiler and link libraries
  446. #
  447. !if $(MODEL) == d || $(MODEL) == x
  448. USEDLL = 1
  449. !endif
  450. _MODEL_ = $(MODEL)
  451. !if $(_32BIT_)
  452. _MODEL_ = f
  453. !else
  454. ! ifdef USEDLL
  455. _MODEL_ = l
  456. ! endif
  457. DMODEL = l
  458. !endif
  459.  
  460. #
  461. # Set parameters for .DEF file
  462. #
  463. !ifndef STACKSIZE  #used for 16-bit only
  464. STACKSIZE = 16384
  465. !endif
  466.  
  467. !ifndef HEAPSIZE   #used for 16-bit only
  468. ! ifdef USEDLL
  469. HEAPSIZE = 4096
  470. ! else
  471. HEAPSIZE = 4096
  472. ! endif
  473. !endif
  474.  
  475. #----------------------------------------------------------------------------
  476. # Check target options and dependencies, setup defaults
  477. #----------------------------------------------------------------------------
  478.  
  479. #
  480. # Set .RES file if one implied by xxxRES, set target file names
  481. #
  482. !ifdef EXERES
  483. EXE = $(EXERES)
  484. ! ifndef RESEXE
  485. RESEXE = $(EXE).res
  486. ! endif
  487. !endif
  488. !ifdef EXE
  489. ! ifndef EXEBIN
  490. EXEBIN = $(EXE).exe
  491. ! endif
  492. ! ifndef CFGEXE
  493. CFGEXE = cfgexe
  494. ! endif
  495. !endif
  496.  
  497. !if $(SYSTEM)==DOS16
  498. ! undef RESEXE
  499. ! undef DLL
  500. ! undef DLLRES
  501. ! undef DLLBIN
  502. !endif
  503.  
  504. !ifdef DLLRES
  505. DLL = $(DLLRES)
  506. ! ifndef RESDLL
  507. RESDLL = $(DLL).res
  508. ! endif
  509. !endif
  510. !ifdef DLL
  511. ! ifndef CFGDLL
  512. CFGDLL = cfgdll
  513. ! endif
  514. ! ifndef DLLBIN
  515. DLLBIN = $(DLL).dll
  516. ! endif
  517. !endif
  518.  
  519. !ifdef HLP
  520. HLPBIN = $(HLP: =.hlp ).hlp
  521. !endif
  522.  
  523. #----------------------------------------------------------------------------
  524. # Debug & diagnostic flags
  525. #----------------------------------------------------------------------------
  526. !if $(DEBUG) != 0
  527. DEBUG = 1
  528. ! if $(_32BIT_)
  529. LDBG = -v
  530. ! else
  531. LDBG = -v -Vt
  532. ! endif
  533. !else
  534. DEBUG = 0
  535. !endif
  536.  
  537. !if $(DIAGS) != 0          # default diags use precondition, check, trace & warn
  538. DIAGS = 1
  539. __DEBUG=2
  540. __TRACE=1
  541. __WARN=1
  542. !else
  543. DIAGS = 0
  544. !endif
  545.  
  546. !ifdef __DEBUG
  547. CDIAG = -D__DEBUG=$(__DEBUG)
  548. !endif
  549. !ifdef __TRACE
  550. CDIAG = $(CDIAG) -D__TRACE
  551. !endif
  552. !ifdef __WARN
  553. CDIAG = $(CDIAG) -D__WARN
  554. !endif
  555.  
  556. #----------------------------------------------------------------------------
  557. # Library names
  558. #   STDLIBS  - RTL libs for use by current model
  559. #   STDDLIBS - RTL libs for use by DLLs
  560. #   C0       - Startup code for current model
  561. #   C0D      - Startup code for DLLs
  562. #----------------------------------------------------------------------------
  563. RTLPFX=cw
  564. RTLDIR=$(BCLIBDIR)
  565.  
  566. !if $(_32BIT_)
  567.  
  568. ! if $d(VCL)
  569.   RTLPFX=cp
  570.   RTLDIR=$(VCLLIBDIR)
  571. ! endif
  572.  
  573. STDDLIBS = $(BCLIBDIR)\import32
  574. ! if $d(MT)
  575.   STDDLIBS = $(STDDLIBS) $(RTLDIR)\$(RTLPFX)32mti
  576. ! else
  577.   STDDLIBS = $(STDDLIBS) $(RTLDIR)\$(RTLPFX)32i
  578. ! endif
  579. C0D      = $(RTLDIR)\c0d32
  580. ! if $(_GUI_)
  581. _SYSCODE_ = n
  582. C0       = $(RTLDIR)\c0w32
  583. ! else #CON32
  584. C0       = $(RTLDIR)\c0x32
  585. _SYSCODE_ = c
  586. ! endif
  587.  
  588. ! if $d(DEBUG)
  589.   VCLLIB = $(VCLLIBDIR)\vcld.lib
  590. ! else
  591.   VCLLIB = $(VCLLIBDIR)\vcl.lib
  592. ! endif
  593.  
  594. ! ifdef USEDLL
  595.   STDLIBS  = $(STDDLIBS)
  596. ! else
  597. !   if $d(MT)
  598.     STDLIBS  = $(BCLIBDIR)\import32 $(RTLDIR)\$(RTLPFX)32mt
  599. !   else
  600.     STDLIBS  = $(BCLIBDIR)\import32 $(RTLDIR)\$(RTLPFX)32
  601. !   endif
  602. ! endif
  603.  
  604. ! if $d(VCL)
  605.   STDLIBS  = $(STDLIBS) $(VCLLIB)
  606. ! endif
  607.  
  608. ! if $d(CODEGUARD)  # Codeguard must preceed all user/frmwk libraries
  609. _RTLFIRST_= $(BCLIBDIR)\cg32 $(_RTLFIRST_)
  610. ! endif
  611.  
  612. !elif $(_GUI_) #WIN16
  613. C0       = $(BCLIBDIR)\c0w$(_MODEL_)
  614. C0D      = $(BCLIBDIR)\c0d$(DMODEL)
  615. STDDLIBS=$(BCLIBDIR)\import $(BCLIBDIR)\crtldll
  616. ! if $d(USEDLL)
  617. STDLIBS  = $(STDDLIBS)
  618. ! else
  619. !   if $d(RTLFIRST)
  620. _RTLFIRST_ = $(BCLIBDIR)\$(RTLPFX)$(_MODEL_)$(sp)
  621. STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_)
  622. !   else
  623. STDLIBS =$(BCLIBDIR)\import $(BCLIBDIR)\mathw$(_MODEL_) $(BCLIBDIR)\$(RTLPFX)$(_MODEL_)
  624. !   endif
  625. ! endif
  626. ! if $d(FASTTHIS)
  627. SYSTEM = WIN16F
  628. _SYSCODE_ = f
  629.  
  630. ! elif $d(PASCAL)
  631. SYSTEM = WIN16P
  632. _SYSCODE_ = p
  633.  
  634. ! else
  635. SYSTEM = WIN16
  636. _SYSCODE_ = w
  637. ! endif
  638.  
  639. ! if $d(CODEGUARD)      # Codeguard must preceed all user/frmwk libraries
  640. _RTLFIRST_= $(BCLIBDIR)\cg16 $(_RTLFIRST_)
  641. ! endif
  642.  
  643. !else  #DOS16
  644.  
  645. ! if "$(MATHOPT)"=="2"
  646. _MATHLIB_ = $(BCLIBDIR)\fp87 $(BCLIBDIR)\math$(_MODEL_)
  647. ! elif "$(MATHOPT)"=="1"
  648. _MATHLIB_ = $(BCLIBDIR)\emu $(BCLIBDIR)\math$(_MODEL_)
  649. !endif
  650. STDLIBS  = $(_MATHLIB_) $(BCLIBDIR)\c$(_MODEL_)
  651. C0       = $(BCLIBDIR)\c0$(_MODEL_)
  652. SYSTEM = DOS16
  653. _SYSCODE_ = d
  654.  
  655. !endif
  656.  
  657. !ifdef USERLIBS
  658. _USERLIBS_ = $(USERLIBS)+$(nl)
  659. !endif
  660.  
  661. !ifdef SYSLIBS
  662. _SYSLIBS_ = $(SYSLIBS)+$(nl)
  663. !endif
  664.  
  665. !ifdef SYSLIBSD
  666. _SYSLIBSD_ = $(SYSLIBSD)+$(nl)
  667. !else
  668. _SYSLIBSD_ = $(_SYSLIBS_)
  669. !endif
  670.  
  671. !ifdef LIBDLL
  672. _LIBDLL_ = $(LIBDLL)$(sp)
  673. !endif
  674.  
  675. !ifdef LIBEXE
  676. _LIBEXE_ = $(LIBEXE)$(sp)
  677. !endif
  678.  
  679. #
  680. # Set makefile name based on platform, model, debug/diagnostic mode
  681. #
  682. !if $d(VCL)
  683.   KEY = v
  684. !else
  685.   KEY = $(MODEL)
  686. !endif
  687. _MODELNAME_ = $(SYSTEM)$(KEY)$(DIAGS)$(DEBUG)
  688.  
  689. #----------------------------------------------------------------------------
  690. # Options independent of build options
  691. #----------------------------------------------------------------------------
  692. !if $d(REDEFINE_BOOL)
  693.   CFLAGS  = $(CFLAGS)  -DBI_REDEFINE_BOOL
  694.   CFLAGSD = $(CFLAGSD) -DBI_REDEFINE_BOOL
  695. !endif
  696. !if $d(VCL)
  697.   NAMESPACE = 1
  698. !endif
  699. !if $d(NAMESPACE)
  700.   CFLAGS  = $(CFLAGS)  -DBI_NAMESPACE
  701.   CFLAGSD = $(CFLAGSD) -DBI_NAMESPACE
  702. !endif
  703.  
  704. #----------------------------------------------------------------------------
  705. # Tools and options for 32bit Windows and console apps
  706. #----------------------------------------------------------------------------
  707. !if $(_32BIT_)
  708. ! if !$d(BCC32I)
  709.   BCC    = $(BCBINDIR)\bcc32.exe
  710. ! else
  711.   BCC    = $(BCBINDIR)\bcc32i.exe
  712. ! endif
  713.   BRCC     = $(BCBINDIR)\brcc32.exe
  714. ! if $d(ILINK)
  715.   TLINK  = $(BCBINDIR)\ilink32     # incremental linker
  716. ! else
  717.   TLINK  = $(BCBINDIR)\tlink32     # standard linker
  718. ! endif
  719. ! if $(DEBUG)
  720.   COPTS    = -$(CPUOPT) -i55 -d -k -Od -v
  721. ! else
  722.   COPTS    = -$(CPUOPT) -i55 -d -k- -O1gmpv
  723. ! endif
  724. ! if $d(VCL)
  725.   COPTS  = $(COPTS) -b- -Vx -Ve 
  726. ! endif
  727.  
  728. CFGFILE  = bcc32.cfg
  729.  
  730. ! ifdef USEDLL
  731. CFLAGS   = $(CFLAGS) -W -D_RTLDLL $(COPTS)
  732. CFLAGSD  = $(CFLAGSD) -WDE -D_RTLDLL $(COPTS)   # Building DLL's
  733. ! else                                          # Using DLL libraries
  734. CFLAGS   = $(CFLAGS) -W $(COPTS)
  735. CFLAGSD  = $(CFLAGSD) -WDE $(COPTS)             # Building DLL's
  736. ! endif                                         # Using static libraries
  737.  
  738. ! if !$d(MT)
  739. CFLAGS = $(CFLAGS) -WM-
  740. CFLAGSD = $(CFLAGSD) -WM-
  741. ! endif
  742.  
  743. ! if $d(CODEGUARD)             # d=add data, c=add calls, t=check this
  744.     CFLAGS = $(CFLAGS) -vGd -vGt
  745. !   if $(CODEGUARD) == 2
  746.       CFLAGS= $(CFLAGS) -vGc
  747. !   endif
  748. ! endif
  749.  
  750. ! if $d(ALIGN)
  751.     CFLAGS = $(CFLAGS) -a$(ALIGN)
  752. ! endif
  753.  
  754. ! if $(_GUI_) #WIN32
  755. LFLAGS   = -Tpe -aa -c $(LDBG)
  756. LFLAGSD  = -Tpd -aa -c $(LDBG)
  757. ! else #CON32
  758. LFLAGS   = -Tpe -ap -c $(LDBG)
  759. LFLAGSD  = -Tpd -ap -c $(LDBG)
  760. ! endif
  761. ! if $d(VCL)
  762.   LFLAGS  = $(LFLAGS)  -j$(VCLOBJDIR) 
  763.   LFLAGSD = $(LFLAGSD) -j$(VCLOBJDIR) 
  764. ! endif
  765.  
  766. LFLAGS  = /V$(OSMAJOR).$(OSMINOR) $(LFLAGS)
  767. LFLAGSD = /V$(OSMAJOR).$(OSMINOR) $(LFLAGSD)
  768.  
  769. #----------------------------------------------------------------------------
  770. # Tools and options for 16bit Windows and DOS
  771. #----------------------------------------------------------------------------
  772. !else
  773. BCC      = $(BCBINDIR)\bcc.exe
  774. BRCC     = $(BCBINDIR)\brcc.exe
  775. TLINK    = $(BCBINDIR)\tlink.exe
  776. RLINK    = $(BCBINDIR)\rlink.exe -K
  777. ! if $(DEBUG)
  778. COPTS    = -$(CPUOPT) -d -k -Od -v
  779. ! else
  780. COPTS    = -$(CPUOPT) -d -k- -O1gmpv
  781. ! endif
  782. ! if $(_MODEL_) != s && $(_MODEL_) != m
  783. COPTS    = $(COPTS) -dc      # -dc shouldn't be used in small & medium models
  784. ! endif
  785. CFGFILE  = turboc.cfg
  786.  
  787. ! if   $d(FASTTHIS) && $d(PASCAL)
  788.   _CENTRY_ = -D_FASTTHIS -p
  789. ! elif $d(FASTTHIS)
  790.   _CENTRY_ = -D_FASTTHIS
  791. ! elif $d(PASCAL)
  792.   _CENTRY_ = -p
  793. ! endif
  794.  
  795. ! if   $d(USEDLL)                        # using DLL libraries
  796. CFLAGS   = $(CFLAGS) -WS -D_RTLDLL $(COPTS) -m$(_MODEL_) $(_CENTRY_)
  797. CFLAGSD  = $(CFLAGSD) -WD -xc -D_RTLDLL $(COPTS) -m$(DMODEL) $(_CENTRY_) # DLLs
  798. LFLAGS   = -Tw -c -C -Oc -Oi -Oa $(LDBG)
  799. ! elif $(_GUI_)                          # using static libraries
  800. CFLAGS   = $(CFLAGS) -WSE $(COPTS) -m$(_MODEL_) $(_CENTRY_)
  801. CFLAGSD  = $(CFLAGSD) -WDE -xc $(COPTS) -m$(DMODEL) $(_CENTRY_) # DLLs
  802. LFLAGS   = -Tw -c -C -Oc -Oi -Oa $(LDBG)
  803. ! else                                   # using 16-bit DOS
  804. CFLAGS   = $(CFLAGS) $(COPTS) -m$(_MODEL_) $(_CENTRY_)
  805. LFLAGS   = -c -C $(LDBG)
  806. ! endif
  807. LFLAGSD  = -Twd -c -C -Oc -Oi -Oa $(LDBG)
  808.  
  809. ! if $d(CODEGUARD)             # d=add data, c=add calls, t=check this
  810.     CFLAGS = $(CFLAGS) -vGd -vGt
  811. !   if $(CODEGUARD) == 2
  812.       CFLAGS= $(CFLAGS)        # -vGc !valid for 16-bit tools currently
  813. !   endif
  814. ! endif
  815.  
  816. ! if $d(ALIGN)
  817.     CFLAGS = $(CFLAGS) -a$(ALIGN)
  818. ! endif
  819.  
  820. !endif #if/else $(_32BIT_)
  821.  
  822. #----------------------------------------------------------------------------
  823. # Common tools and options
  824. #----------------------------------------------------------------------------
  825. HC       = $(BCBINDIR)\hc31.exe
  826. IMPLIB   = $(BCBINDIR)\implib.exe -c
  827. TLIB     = $(BCBINDIR)\tlib.exe
  828.  
  829. #----------------------------------------------------------------------------
  830. # Configure DLL target
  831. #----------------------------------------------------------------------------
  832.  
  833. !ifdef DLL
  834. ! ifndef OBJDLL   # if no explicit objs, assume one with same base name as DLL
  835. OBJDLL = $(DLL).obj
  836. ! endif
  837.  
  838. #
  839. # Generate default .DEF file if none defined
  840. #
  841. ! ifdef DEFDLL
  842. _DEFDLL_ = $(DEFDLL)
  843. ! elif $(_32BIT_)
  844. _DEFDLL_ = &&|^
  845. LIBRARY $(DLLBIN:.=;)^
  846. EXETYPE WINDOWS^
  847. CODE PRELOAD MOVEABLE DISCARDABLE^
  848. DATA PRELOAD MOVEABLE MULTIPLE^
  849. |
  850. !else
  851. _DEFDLL_ = &&|^
  852. LIBRARY $(DLLBIN:.=;)^
  853. EXETYPE WINDOWS^
  854. CODE PRELOAD MOVEABLE DISCARDABLE^
  855. DATA PRELOAD MOVEABLE SINGLE^
  856. HEAPSIZE $(HEAPSIZE)^
  857. |
  858. ! endif
  859.  
  860. ! ifdef RESDLL   # explicit .res file or space-separated list of .res files
  861. !  if !$(_32BIT_) && "$(RESDLL)" != "$(RESDLL: =)" # >1 16-bit .res file
  862. _RESDLL_ = ^
  863.  $(RLINK) @&&|^
  864. -fi$(RESDLL: = -fi)^
  865. $(DLLBIN)^
  866. |
  867. ! else
  868. _RESDLL_ = ,$(RESDLL)
  869. !  endif
  870. ! endif
  871.  
  872. ! ifdef MAPDLL
  873. !  if "$(MAPDLL)"=="1"
  874. MAPDLL=
  875. !  endif
  876. _MAPDLL_ = -m -s $(MAPDLL)
  877. ! else
  878. _MAPDLL_ = -x
  879. ! endif
  880.  
  881. #
  882. # Construct rule for DLL target - possibility that OBJDLL is blank
  883. #
  884. DLLRULE =^
  885. $(DLLBIN): $(OBJDLL) $(RESDLL) $(DEFDLL) $(LIBDLL)^
  886.   $(TLINK) @&&|^
  887. $(LFLAGSD) -L$(LIBRARYPATH)+^
  888. $(C0D) $(OBJDLL)^
  889. $(DLLBIN)^
  890. $(_MAPDLL_)^
  891. $(_RTLFIRST_)$(_LIBDLL_)$(_USERLIBS_)$(_SYSLIBSD_)$(STDLIBS)^
  892. |,$(_DEFDLL_)$(_RESDLL_)^
  893.   $(IMPLIB) $(DLL) $(DLLBIN)^
  894.  
  895. ! ifndef DLLALL
  896. DLLALL = $(DLLBIN)
  897. ! endif
  898. _DLLALL_ = " $(DLLALL) "
  899. ! ifndef DLLMAKE
  900. DLLMAKE = $(DLLRULE)
  901. ! endif
  902.  
  903. !endif
  904.  
  905. #----------------------------------------------------------------------------
  906. # Configure LIBBIN target
  907. #----------------------------------------------------------------------------
  908.  
  909. !ifdef LIBBIN
  910. ! ifndef CFGEXE
  911. CFGEXE = cfgexe
  912. ! endif
  913. _LIBOBJ1_ = .obj $(OBJLIB)
  914. _LIBOBJ2_ = $(_LIBOBJ1_:.obj =+)
  915. _LIBOBJ_  = $(_LIBOBJ2_:.obj=)
  916. !endif
  917.  
  918. #----------------------------------------------------------------------------
  919. # Configure EXE target
  920. #----------------------------------------------------------------------------
  921.  
  922. !ifdef EXE
  923.  
  924. #
  925. # Generate default .DEF file if none defined
  926. #
  927. ! if $(SYSTEM)==DOS16
  928. !  undef DEFEXE
  929. ! elif $d(DEFEXE)
  930. _DEFEXE_ = ,$(DEFEXE)
  931. ! elif !$(_32BIT_) #WIN16
  932. !  ifdef DOSSTUB
  933. _DEFEXE_ = ,&&|^
  934. EXETYPE WINDOWS^
  935. STUB '$(DOSSTUB)'^
  936. CODE PRELOAD MOVEABLE DISCARDABLE^
  937. DATA PRELOAD MOVEABLE MULTIPLE^
  938. HEAPSIZE $(HEAPSIZE)^
  939. STACKSIZE $(STACKSIZE)^
  940. |
  941. !  else
  942. _DEFEXE_ = ,&&|^
  943. EXETYPE WINDOWS^
  944. CODE PRELOAD MOVEABLE DISCARDABLE^
  945. DATA PRELOAD MOVEABLE MULTIPLE^
  946. HEAPSIZE $(HEAPSIZE)^
  947. STACKSIZE $(STACKSIZE)^
  948. |
  949. !  endif
  950. ! elif $(_GUI_)    #WIN32
  951. _DEFEXE_ = ,&&|^
  952. EXETYPE WINDOWS^
  953. CODE PRELOAD MOVEABLE DISCARDABLE^
  954. DATA PRELOAD MOVEABLE MULTIPLE^
  955. |
  956. ! else             #CON32
  957. _DEFEXE_ = ,&&|^
  958. CODE PRELOAD MOVEABLE DISCARDABLE^
  959. DATA PRELOAD MOVEABLE MULTIPLE^
  960. |
  961. ! endif
  962.  
  963. ! ifdef RESEXE   # explicit .res file or space-separated list of .res files
  964. !  if !$(_32BIT_) && "$(RESEXE)" != "$(RESEXE: =)" # >1 16-bit .res file
  965. _RESEXE_ = ^
  966.  $(RLINK) @&&|^
  967. -fi$(RESEXE: = -fi)^
  968. $(EXEBIN)^
  969. |
  970. ! else
  971. _RESEXE_ = ,$(RESEXE)
  972. !  endif
  973. ! endif
  974.  
  975. ! ifndef OBJEXE   # if no explicit objs, assume one with same base name as EXE
  976. OBJEXE = $(EXE).obj
  977. ! endif
  978. ! ifdef MAPEXE
  979. !  if "$(MAPEXE)"=="1"
  980. MAPEXE=
  981. !  endif
  982. _MAPEXE_ = -m -s $(MAPEXE)
  983. ! else
  984. _MAPEXE_ = -x
  985. ! endif
  986.  
  987. #
  988. # Construct rule for EXE target
  989. #
  990. EXERULE =^
  991. $(EXEBIN): $(OBJEXE) $(RESEXE) $(DEFEXE) $(LIBEXE) $(EXE_)^
  992.   $(TLINK) @&&|^
  993. $(LFLAGS) -L$(LIBRARYPATH) $(C0)+^
  994. $(OBJEXE)^
  995. $(EXEBIN)^
  996. $(_MAPEXE_)^
  997. $(_RTLFIRST_)$(_USERLIBS_)$(_SYSLIBS_)$(_LIBEXE_)$(STDLIBS)^
  998. |$(_DEFEXE_)$(_RESEXE_)^
  999.  
  1000. ! ifndef EXEALL
  1001. EXEALL = $(EXEBIN)
  1002. ! endif
  1003. _EXEALL_ = " $(EXEALL) "
  1004. ! ifndef EXEMAKE
  1005. EXEMAKE = $(EXERULE)
  1006. ! endif
  1007.  
  1008. !endif
  1009.  
  1010. #----------------------------------------------------------------------------
  1011. # Define config file cleanup if any config files generated
  1012. #----------------------------------------------------------------------------
  1013.  
  1014. !if $d(EXE) || $d(LIBBIN) || $d(DLL)
  1015. ! ifndef CFGCLN
  1016. CFGCLN = cfgcln
  1017. ! endif
  1018. !else
  1019. !undef CFGCLN
  1020. !endif
  1021.  
  1022. #----------------------------------------------------------------------------
  1023. # Run makefile - dependent upon generated makefile and generated model sentry
  1024. #----------------------------------------------------------------------------
  1025.  
  1026. !ifndef MAKEFILE
  1027. MAKEFILE = $(_MODELNAME_).mak
  1028. !endif
  1029.  
  1030. _SENTRY_ = $(_MODELNAME_).mod
  1031.  
  1032. !ifdef TARGET
  1033. _TARGXX_ = |$(TARGET)|
  1034. _TARGBB_ = $(_TARGXX_:|= )
  1035. ! if   $(_EXEALL_:$(_TARGBB_)=) != $(_EXEALL_)
  1036. _TARGET_ = $(CFGEXE) $(TARGET) $(CFGCLN)
  1037. ! elif $(_DLLALL_:$(_TARGBB_)=) != $(_DLLALL_)
  1038. _TARGET_ = $(CFGDLL) $(TARGET) $(CFGCLN)
  1039. ! else
  1040. !  error TARGET=$(TARGET)^
  1041.    $(TARGET) is not in target list (all: ...) for makefile $(MAKEFILE)
  1042. ! endif
  1043. !endif
  1044.  
  1045. all: $(MAKEFILE) $(_SENTRY_)
  1046.   @$(MAKEDIR)\$(MAKE) -f$(MAKEFILE) $(MAKEARGS) $(_TARGET_)
  1047.  
  1048. #----------------------------------------------------------------------------
  1049. # Generate makefile
  1050. #----------------------------------------------------------------------------
  1051.  
  1052. ECHOOPTS= $(nl)Generating $(MAKEFILE)$(nl)
  1053. ECHOOPTS= $(ECHOOPTS) SYSTEM is $(SYSTEM).$(nl)
  1054. ECHOOPTS= $(ECHOOPTS) MODEL is $(MODEL).$(nl)
  1055. !if $d(USEDLL)
  1056. ECHOOPTS= $(ECHOOPTS) DLL versions of RTL/BIDS/OWL libraries.$(nl)
  1057. !else
  1058. ECHOOPTS= $(ECHOOPTS) Static versions of RTL/BIDS/OWL libraries.$(nl)
  1059. !endif
  1060. !if $d(NAMESPACE)
  1061. ECHOOPTS= $(ECHOOPTS) Namespaces are ON.$(nl)
  1062. !endif
  1063. !if $d(VCL)
  1064. ECHOOPTS= $(ECHOOPTS) VCL compatibility is ON.$(nl)
  1065. !endif
  1066. ECHOOPTS= $(ECHOOPTS) OS version $(OSMAJOR).$(OSMINOR).$(nl)
  1067. ECHOOPTS= $(ECHOOPTS) CPU set to $(CPUOPT)86.$(nl)
  1068. !if $(MATHOPT)==0
  1069. ECHOOPTS= $(ECHOOPTS) Math libraries set to none.$(nl)
  1070. !elif $(MATHOPT)==1
  1071. ECHOOPTS= $(ECHOOPTS) Math libraries set to emulation.$(nl)
  1072. !elif $(MATHOPT)==2
  1073. ECHOOPTS= $(ECHOOPTS) Math libraries set to coprocessor.$(nl)
  1074. !endif
  1075. ECHOOPTS= $(ECHOOPTS) Alignment set to $(ALIGN).$(nl)
  1076. !if $(DIAGS)==1
  1077. ECHOOPTS= $(ECHOOPTS) Diagnostics messages are on.$(nl)
  1078. !else
  1079. ECHOOPTS= $(ECHOOPTS) Diagnostics messages are off.$(nl)
  1080. !endif
  1081. !if $(DEBUG)==1
  1082. ECHOOPTS= $(ECHOOPTS) Debugging information is generated.$(nl)
  1083. !else
  1084. ECHOOPTS= $(ECHOOPTS) Debugging information is not generated.$(nl)
  1085. !endif
  1086. !if $d(BCC32I)
  1087. ECHOOPTS= $(ECHOOPTS) Compiler: BCC32I (Intel).$(nl)
  1088. !elif $(_32BIT_)==1
  1089. ECHOOPTS= $(ECHOOPTS) Compiler: BCC32 (standard).$(nl)
  1090. !else
  1091. ECHOOPTS= $(ECHOOPTS) Compiler: BCC (standard).$(nl)
  1092. !endif
  1093. !if $d(ILINK)
  1094. ECHOOPTS= $(ECHOOPTS) Linker: ILINK32 (incremental).$(nl)
  1095. !elif $(_32BIT_)==1
  1096. ECHOOPTS= $(ECHOOPTS) Linker: TLINK32 (standard).$(nl)
  1097. !else
  1098. ECHOOPTS= $(ECHOOPTS) Linker: TLINK (standard).$(nl)
  1099. !endif
  1100. !if $(CODEGUARD)==0
  1101. ECHOOPTS= $(ECHOOPTS) No CodeGuard information generated.$(nl)
  1102. !elif $(CODEGUARD)==1
  1103. ECHOOPTS= $(ECHOOPTS) Basic CodeGuard information generated.$(nl)
  1104. !else
  1105. ECHOOPTS= $(ECHOOPTS) Full CodeGuard information generated.$(nl)
  1106. !endif
  1107. !if $d(USERINCPATH)
  1108. ECHOOPTS= $(ECHOOPTS) User include path: $(USERINCPATH).$(nl)
  1109. !endif
  1110. !if $d(USERINCPATH)
  1111. ECHOOPTS= $(ECHOOPTS) User lib path: $(USERLIBPATH).$(nl)
  1112. !endif
  1113. !if $d(USERLIBS)
  1114. ECHOOPTS= $(ECHOOPTS) User libraries: $(USERLIBS).$(nl)
  1115. !endif
  1116.  
  1117. #
  1118. $(MAKEFILE) :: makefile
  1119.   @type &&|
  1120. $(ECHOOPTS)
  1121. |
  1122.   @if exist $(MAKEFILE) del $(MAKEFILE)
  1123.   @rename &&%
  1124. .autodepend
  1125.  
  1126. all: $(CFGDLL) $(DLLALL) $(CFGEXE) $(LIBBIN) $(EXEALL) $(HLPBIN) $(TARGETS) $(CFGCLN)
  1127.   @echo SYSTEM=$(SYSTEM) MODEL=$(MODEL) DIAGS=$(DIAGS) DEBUG=$(DEBUG)
  1128.  
  1129. #
  1130. # Standard implicit rules
  1131. #
  1132. .rc.res:
  1133.   $(BRCC) -r -i$(INCLUDEPATH) $$<
  1134. .cpp.obj:
  1135.   $(BCC) {$$< }
  1136. .c.obj:
  1137.   $(BCC) {$$< }
  1138. !ifdef HLP
  1139. .hpj.hlp:
  1140.   $(HC) $$<
  1141. !endif
  1142.  
  1143. #
  1144. # Dependencies
  1145. #
  1146. !ifdef HLP_
  1147.  
  1148. $(HLPBIN) : $(HLP_)
  1149. !endif
  1150. !ifdef RESEXE_
  1151.  
  1152. $(RESEXE) : $(RESEXE_)
  1153. !endif
  1154. !ifdef RESDLL_
  1155.  
  1156. $(RESDLL) : $(RESDLL_)
  1157. !endif
  1158.  
  1159. #
  1160. # DLL target - also makes import library
  1161. #
  1162. !ifdef DLL
  1163.  
  1164. #
  1165. # Generate compiler configuration file for DLL source files
  1166. #
  1167. !if "$(CFGDLL)" == "cfgdll"
  1168. cfgdll:
  1169.   @copy &&|
  1170. -I$(INCLUDEPATH)
  1171. -c $(CFLAGSD)
  1172. -w $(CDIAG) $(CPCHD) $(CCFDLL)
  1173. | $(CFGFILE) >NUL
  1174. !endif
  1175.  
  1176. #
  1177. # Link DLL and generate import library
  1178. #
  1179. $(DLLMAKE)
  1180. !endif # $d(DLL)
  1181.  
  1182. #
  1183. # Generate compiler configuration file for EXE and LIB source files
  1184. #
  1185. !if ($d(EXE) || $d(LIBBIN)) && "$(CFGEXE)" == "cfgexe"
  1186. cfgexe:
  1187.   @copy &&|
  1188. -I$(INCLUDEPATH)
  1189. -c $(CFLAGS)
  1190. -w $(CDIAG) $(CPCH) $(CCFEXE)
  1191. | $(CFGFILE) >NUL
  1192. !endif
  1193.  
  1194. #
  1195. # LIBBIN target
  1196. #
  1197. !ifdef LIBBIN
  1198.  
  1199. $(LIBBIN) : $(OBJLIB)
  1200.   @if exist $(LIBBIN) del $(LIBBIN)
  1201.   $(TLIB) $(LIBBIN) $(_LIBOBJ_)
  1202. !endif
  1203.  
  1204. #
  1205. # EXE target
  1206. #
  1207. !ifdef EXE
  1208. $(EXEMAKE)
  1209. !endif
  1210. !if "$(CFGCLN)" == "cfgcln"
  1211. cfgcln:
  1212.   @del $(CFGFILE)
  1213. !endif
  1214. $(RULES)
  1215. % $(MAKEFILE)
  1216.  
  1217. #----------------------------------------------------------------------------
  1218. # Generate model sentries, clean files of other models
  1219. #----------------------------------------------------------------------------
  1220.  
  1221. #
  1222. # Generate model sentry, name contains model information
  1223. #
  1224. $(_SENTRY_):
  1225.   @if exist *.mod del *.mod
  1226.   -@type NUL >$(_SENTRY_) # ignore return code generated by some command shell
  1227. !if $(NOCLEAN) != 0
  1228.   @echo Created model sentry: $(_SENTRY_), NOT deleting files of other models!
  1229. !else
  1230.   @echo Created model sentry: $(_SENTRY_), Deleting files of other models...
  1231. ! if $d(EXEBIN) && "EXEBIN" != "$(EXE).exe"
  1232.   @if exist $(EXEBIN) del $(EXEBIN)  # in case extension not .exe
  1233. ! endif
  1234. ! ifdef LIBBIN
  1235.   @if exist $(LIBBIN) del $(LIBBIN)  # only delete the target .lib
  1236. ! endif
  1237. ! ifdef DLLBIN
  1238.   @if exist $(DLLBIN) del $(DLLBIN)  # only delete the target .dll
  1239. ! endif
  1240.   @if exist *.obj del *.obj
  1241.   @if exist *.res del *.res
  1242. !endif
  1243.  
  1244. #----------------------------------------------------------------------------
  1245. # Delete all generated files, leaving only source files and makefiles
  1246. #----------------------------------------------------------------------------
  1247. clean:
  1248.   @if exist *.mod del *.mod
  1249.   @if exist *.obj del *.obj
  1250.   @if exist *.exe del *.exe
  1251.   @if exist *.dll del *.dll
  1252.   @if exist *.hlp del *.hlp
  1253.   @if exist *.scr del *.scr
  1254.   @if exist *.res del *.res
  1255.   @if exist *.rws del *.rws
  1256.   @if exist *.lib del *.lib
  1257.   @if exist *.map del *.map
  1258.   @if exist *.csm del *.csm
  1259.   @if exist bcwdef.* del bcwdef.*
  1260.   @if exist *.dsw del *.dsw
  1261.   @if exist *.mbt del *.mbt
  1262.   @if exist *.mrt del *.mrt
  1263.   @if exist turboc.cfg del turboc.cfg
  1264.   @if exist bcc32.cfg del bcc32.cfg
  1265.   @if exist tlink.cfg del tlink.cfg
  1266.   @if exist tlink32.cfg del tlink32.cfg
  1267.   @if exist ilink32.cfg del ilink32.cfg
  1268.   @if exist *.td? del *.td? #debugger symbols & configs
  1269.   @if exist *.tr? del *.tr? #debugger restart
  1270.   @if exist WIN16*.mak del WIN16*.mak
  1271.   @if exist WIN32*.mak del WIN32*.mak
  1272.   @if exist DOS16*.mak del DOS16*.mak
  1273.   @if exist CON32*.mak del CON32*.mak
  1274.